﻿using System;
using System.Text;
using System.Drawing;
using System.Buffers;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;

public static partial class glDRIVE
{
    /*
    函数 gl.pqg2
    计算二重积分的连分式
    固定一个x，用连分式法计算一个对y的积分近似值。
    参数 x: 
    参数 eps: 
    返回值 
    */

    public static unsafe string drive_pqg2()
    {
        double a, b, eps, s;
        a = 0.0;
        b = 1.0;
        eps = 0.00001;
        gl.s_x_ya = pqg2s;
        gl.f_xy = pqg2f;
        s = gl.pqg2(a, b, eps);
        return gl.html_table("计算二重积分的连分式:", new double[] { s });
    }

    // 计算上下限y1(x)与y0(x)
    private static unsafe void pqg2s(double x, double* y)
    {
        y[1] = Math.Sqrt(1.0 - x * x);
        y[0] = -y[1];
        return;
    }

    // 计算被积函数值f(x,y)
    private static double pqg2f(double x, double y)
    {
        double z;
        z = Math.Exp(x * x + y * y);
        return (z);
    }
}